-
Notifications
You must be signed in to change notification settings - Fork 708
Add ArbFilteredTransactionsManager precompile #4174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ArbFilteredTransactionsManager precompile #4174
Conversation
1adc79f to
81f4e5e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4174 +/- ##
==========================================
- Coverage 32.69% 32.68% -0.02%
==========================================
Files 467 469 +2
Lines 56373 56512 +139
==========================================
+ Hits 18433 18472 +39
- Misses 34720 34819 +99
- Partials 3220 3221 +1 |
❌ 3 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
45fb413 to
67c13f2
Compare
7b7a735 to
f56f36c
Compare
Tristan-Wilson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a minor comment about consistency of the interface with other precompiles.
| return filteredState.IsFiltered(txHash) | ||
| } | ||
|
|
||
| func (con ArbFilteredTransactionsManager) hasAccess(c *Context) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This signature is slightly different to ArbNativeTokenManager which has
func (con ArbNativeTokenManager) hasAccess(c ctx) bool {
manager, err := c.State.NativeTokenOwners().IsMember(c.caller)
return manager && err == nil
}
and therefore the behavior when there is an error is slightly different in this implementation in that if there is an error, then the gas is not burned out.
Unsure if this difference is intentional or not.
|
We should consider making |
@Tristan-Wilson, wdyt about going further: remove ArbNativeToken-style check and return an error right in CensorPrecompile, like in ArbOwner? |
| "github.com/offchainlabs/nitro/solgen/go/precompilesgen" | ||
| ) | ||
|
|
||
| func TestManageTransactionCensors(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also test that the transactions that should be free are free? You can look at TestArbNativeTokenManager and getGasUsed inside it for inspiration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really get how to use getGasUsed in this case, since the transaction will still cost something, only the add/delete call is free. I can suggest to use multigas like this:
tx, err = arbFilteredTxs.AddFilteredTransaction(&censorTxOpts, txHash)
require.NoError(t, err)
receipt, err := builder.L2.EnsureTxSucceeded(tx)
require.NoError(t, err)
require.Equal(t, uint64(0), receipt.MultiGasUsed.Get(multigas.ResourceKindStorageAccess))
This somehow proves that tx did not perform any storage operations like set and clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check the censor account's balance is unchanged after adding/deleting filtered txs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This precompile wrapper does not make the transaction completely free, but I still believe that this test is useful because it allows to verify that the call goes through the wrapper
…ransactionsmanager-precompile
changelog/mrogachev-nit-4245.md
Outdated
| ### Added | ||
| - Add new precompile ArbFilteredTransactionsManager to manage filtered transactions | ||
| - Add transaction filterers to ArbOwner to limit access to ArbFilteredTransactionsManager | ||
| - Limit ArbOwners ability to create transaction filterers with TransactionFilteringFromTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: ArbOwners -> ArbOwners'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
precompiles/ArbOwnerPublic.go
Outdated
|
|
||
| // GetAllTransactionFilterers retrieves the list of transaction filterers | ||
| func (con ArbOwnerPublic) GetAllTransactionFilterers(c ctx, evm mech) ([]common.Address, error) { | ||
| return c.State.TransactionFilterers().AllMembers(65536) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this magic number? 65536?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same magic limiter exist in a few more places, replaced all with maxGetAllMembers
| ArbOwnerPublic.methodsByName["IsNativeTokenOwner"].arbosVersion = params.ArbosVersion_41 | ||
| ArbOwnerPublic.methodsByName["GetAllNativeTokenOwners"].arbosVersion = params.ArbosVersion_41 | ||
| ArbOwnerPublic.methodsByName["GetParentGasFloorPerToken"].arbosVersion = params.ArbosVersion_50 | ||
| ArbOwnerPublic.methodsByName["GetMaxStylusContractFragments"].arbosVersion = params.ArbosVersion_60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this change have anything to do with StylusContractFragments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The StylusContractFragments precompile interface was already merged, but nitro PR not yet
…ransactionsmanager-precompile
Fixes NIT-4152 and NIT-4253
pulls in OffchainLabs/nitro-precompile-interfaces#25
pulls in OffchainLabs/go-ethereum#604
pulls in OffchainLabs/nitro-testnode#173
Changes:
ArbFilteredTransactionsManagerto manage filtered transactionsArbFilteredTransactionsManager